


import csv




with open('train.csv', 'w') as csvfile:
    spamwriter = csv.writer(csvfile, dialect='excel')
    with open('train', 'r', encoding='utf-8') as filein:
        for line in filein:
            #line = line.encode(''utf-8'')
            line_list = line.strip('\n').split(',')
            spamwriter.writerow(line_list)

with open('test.csv', 'w') as csvtest:
    spamwriter_test = csv.writer(csvtest, dialect='excel')
    with open('test', 'r', encoding='utf-8') as filetestin:
        for line in filetestin:
            #line = line.encode(''utf-8'')
            line_list = line.strip('\n').split(',')
            spamwriter_test.writerow(line_list)

print('DataTransfrom finished')